package logic

import (
	"time"
	"vueAdmin/application/model"
	"vueAdmin/application/utils"
)

func GetToken(username string, password string) string {

	id := model.GetToken(username, password)
	if id == "" {

	}
	res := utils.Md5(id + time.Now().String())
	oldToken, _ := model.RedisClient.Get(id).Result()
	_, _ = model.RedisClient.Del(oldToken).Result()
	model.RedisClient.Set(res, id, time.Second*24*60*60)
	model.RedisClient.Set(id, res, time.Second*24*60*60)

}
